package com.svmc.app.task.activity;

import com.svmc.app.task.adapter.DbAdapter;
import com.svmc.app.task.model.HelpModel;
import com.svmc.app.task.tabmanager.TabGroupActivity;
import com.svmc.app.task.utils.CommonDefine;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import luyenlv.pro.screen.base.BaseActivity;

public class Detail_Help extends BaseActivity implements OnClickListener,CommonDefine {
	TextView title_tip;
	TextView content_tip;
	DbAdapter db;
	HelpModel help;
	int id;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(getLayout(R.array.detail_help));
		findViewById(R.id.detail_help_img_back).setOnClickListener(this);
		title_tip = (TextView)findViewById(R.id.detail_help_txt_title);
		content_tip =(TextView)findViewById(R.id.detail_help_txt_content);
		
		db = new DbAdapter(this);
		Bundle bundle = getIntent().getExtras();
		id = bundle.getInt("ID_HELP");
		Log.i("ID HELP", ""+id);
		fillData(id);
	}
	@Override
	protected void onSaveInstanceState(Bundle outState) {
		// TODO Auto-generated method stub
		super.onSaveInstanceState(outState);
		TabGroupActivity.stateActivity=DETAIL_HELP;
		TabGroupActivity.id_data =id;
	}
	

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.detail_help_img_back:
			finishFromChild(this);
			break;

		default:
			break;
		}
		
	}
	public void fillData(int id){
		help = db.getDetailHelpByID(id);
		title_tip.setText(help.getNameTip());
		content_tip.setText(help.getConceptTip());
		
	}
	
	@Override
	public void clearMemory() {
		

	}
	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		title_tip=null;
		content_tip=null;
		db=null;
		help=null;
		System.gc();
	}

}
